﻿<%@ Page Title="Mobilhjulskift.dk - Erhverv: Kundedata" Language="C#" MasterPageFile="~/Portal/CustomerPortal.Master" AutoEventWireup="true" CodeBehind="CustomerData.aspx.cs" Inherits="TireService.Business.Portal.CustomerView.CustomerData" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script src="../../Scripts/ModalPopup.js" type="text/javascript"></script>

    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgCustomer" alt="" src="~/Images/Medium/businessman.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblCustomerHeader" runat="server" Text="Rediger kunde"></asp:Label></h3>
            </td>
            <td>
                <asp:UpdatePanel ID="upMessage" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table border="0" cellspacing="0" cellpadding="5">
                            <tr>
                                <td>
                                    <div style="font-family: Tahoma; font-size: 9pt; font-weight: normal; color: #f15e34">
                                        &nbsp;<asp:Literal ID="lMessage" runat="server"></asp:Literal>
                                    </div>
                                </td>
                            </tr>
                        </table>          
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>

    <asp:UpdatePanel ID="upCustomerData" runat="server">
        <ContentTemplate>
        
            <table border="0" cellspacing="0" cellpadding="5" width="450px">
                <tr>
                    <td>
                        <asp:Label ID="lblCustomerNumber" runat="server" Text="Kundenr:"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCustomerNumberValue" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblParentCompany" runat="server" Text="Tilknyttet firma:"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblParentCompanyValue" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblParentPayInvoice" runat="server" Text="Fakturer tilknyttet firma:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxCheckBox ID="cbParentPayInvoice" runat="server" Enabled="false">
                        </dx:ASPxCheckBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblCompanyName" runat="server" Text="Firmanavn:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtCompanyName" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblCompanyNumber" runat="server" Text="CVR:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtCompanyNumber" runat="server" Width="75px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblName" runat="server" Text="Kontaktperson:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtName" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblAddress" runat="server" Text="Adresse:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtAddress" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblZipCode" runat="server" Text="Postnr:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtZipCode" runat="server" Width="50px">
                            <MaskSettings Mask="0000" ErrorText="Postnr skal angives med 4 tal" />
                            <ValidationSettings ErrorDisplayMode="ImageWithTooltip" />
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblCity" runat="server" Text="By:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtCity" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblCountry" runat="server" Text="Land:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxComboBox ID="ddlCountry" DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith" runat="server">
                        </dx:ASPxComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblSecondaryAddress" runat="server" Text="Sekundær adresse:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtSecondaryAddress" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblSecondaryZipCode" runat="server" Text="Sekundær postnr:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtSecondaryZipCode" runat="server" Width="50px">
                            <MaskSettings Mask="0000" ErrorText="Postnr skal angives med 4 tal" />
                            <ValidationSettings RequiredField-IsRequired="false" ErrorDisplayMode="ImageWithTooltip" />
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblSecondaryCity" runat="server" Text="Sekundær by:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtSecondaryCity" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblPhone1" runat="server" Text="Telefon:"></asp:Label>
                    </td>
                    <td>
                            <table border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td>
                                    <dx:ASPxTextBox ID="txtPhone1" runat="server" Width="75px">
                                        <MaskSettings Mask="00000000" ErrorText="Telefon nr. ikke gyldigt" />
                                        <ValidationSettings ErrorDisplayMode="ImageWithTooltip" />
                                    </dx:ASPxTextBox>
                                </td>
                                <td>&nbsp;</td>
                                <td>
                                    <dx:ASPxComboBox ID="ddlPhone1Type" runat="server" Width="75px">
                                        <Items>
                                            <dx:ListEditItem Value="0" Text="Mobil" />
                                            <dx:ListEditItem Value="1" Text="Fastnet" />
                                        </Items>
                                    </dx:ASPxComboBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblPhone2" runat="server" Text="Telefon2:"></asp:Label>
                    </td>
                    <td>
                        <table border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td>
                                    <dx:ASPxTextBox ID="txtPhone2" runat="server" Width="75">
                                        <MaskSettings Mask="00000000" ErrorText="Telefon nr. ikke gyldigt" />
                                        <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-IsRequired="false" />
                                    </dx:ASPxTextBox>
                                </td>
                                <td>&nbsp;</td>
                                <td>
                                    <dx:ASPxComboBox ID="ddlPhone2Type" runat="server" Width="75px">
                                        <Items>
                                            <dx:ListEditItem Value="0" Text="Mobil" />
                                            <dx:ListEditItem Value="1" Text="Fastnet" />
                                        </Items>
                                    </dx:ASPxComboBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblEmail" runat="server" Text="Email:"></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxTextBox ID="txtEmail" runat="server" Width="182px">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblPrimaryAddressTimeInterval" runat="server" Text="I tidsrummet 8-16 holder bilen typisk på "></asp:Label>
                    </td>
                    <td>
                        <dx:ASPxRadioButtonList ID="rbPrimaryAddressTimeInterval" runat="server" Width="250px">
                            <ValidationSettings ErrorDisplayMode="ImageWithTooltip" ValidationGroup="Step3" RequiredField-IsRequired="true" RequiredField-ErrorText="Venligst vælg hvilken adresse bilen typisk holder på i tidsrummet kl. 8-16"></ValidationSettings>
                            <Items>
                                <dx:ListEditItem Value="false" Text="Primær adressen" />
                                <dx:ListEditItem Value="true" Text="Sekundær adressen" />
                            </Items>
                        </dx:ASPxRadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="btnSaveCustomer" runat="server" Text="Gem" 
                            onclick="btnSaveCustomer_Click" />
                    </td>
                </tr>
            </table>

        </ContentTemplate>
    </asp:UpdatePanel>

    <h4>Underliggende afdelinger/kontakter</h4>
    <dx:ASPxGridView ID="gvCustomer" runat="server" ClientInstanceName="gvCustomer" 
        KeyFieldName="CustomerId" Width="100%" AutoGenerateColumns="False" EnableCallBacks="True" 
        oncustomunboundcolumndata="gvCustomer_CustomUnboundColumnData" >
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="25" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} afdelinger/kontaktpersoner)" 
                Text="Side {0} af {1} ({2} afdelinger/kontaktpersoner)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette denne kunde?" GroupPanel="Træk kolonne hertil for at gruppere efter den" HeaderFilterShowAll="Vis alle" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" />
        <Columns>
            <dx:GridViewDataColumn FieldName="CustomerId" VisibleIndex="2" Caption="Kundenr">
            </dx:GridViewDataColumn>
            <dx:GridViewDataHyperLinkColumn FieldName="ParentCustomerId" VisibleIndex="2" Caption="Hovedafdeling">
                <PropertiesHyperLinkEdit NavigateUrlFormatString="~/Portal/CustomerView/CustomerData.aspx?CustomerId={0}" TextField="ParentCustomerId">
                </PropertiesHyperLinkEdit>
            </dx:GridViewDataHyperLinkColumn>
            <dx:GridViewDataColumn FieldName="CompanyName" VisibleIndex="3" Caption="Firma">
            </dx:GridViewDataColumn>
            <dx:GridViewDataHyperLinkColumn FieldName="CustomerId" VisibleIndex="3" Caption="Kontaktperson">
                <PropertiesHyperLinkEdit NavigateUrlFormatString="~/Portal/CustomerView/CustomerData.aspx?CustomerId={0}" TextField="Name">
                </PropertiesHyperLinkEdit>
            </dx:GridViewDataHyperLinkColumn>
            <dx:GridViewDataColumn FieldName="Address" VisibleIndex="4" Caption="Adresse">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="ZipCode" VisibleIndex="5" Caption="Postnr">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="City" VisibleIndex="6" Caption="By">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="CountryId" VisibleIndex="7" Caption="CountryId" Visible="false">
            </dx:GridViewDataColumn>
            <dx:GridViewDataTextColumn FieldName="CountryName" VisibleIndex="8" UnboundType="String" Caption="Land">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataColumn FieldName="Phone1" VisibleIndex="12" Caption="Telefon">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="Phone2" VisibleIndex="13" Caption="Telefon2">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="Email" VisibleIndex="14" Caption="Email">
            </dx:GridViewDataColumn>
        </Columns>
    </dx:ASPxGridView>

</asp:Content>
